<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="../core/include.inc.jsp"%>

<style>
    .pageFormContent p {
        width: 90%;
    }
</style>

<div class="pageContent">
    <form method="post" action="ann_add" class="pageForm required-validate ann-add"
          onsubmit="return validateCallback(this, dialogAjaxDone)">

        <div class="pageFormContent nowrap" layoutH="57">

            <p>
                <label>公告类型：</label>
                <select class="combox" name="types">
                    <option value="">全部状态</option>
                    <option value="物业公告">物业公告</option>
                    <option value="社区公告">社区公告</option>
                </select>
            </p>

            <p>
                <label>标题：</label>
                <input type="text" name="title" class="required"/>
            </p>

            <table width="100%">
                <tr class="text-normal">
                    <td>
                        <label>图片：</label>
                        <div class="image-logo">
                            <img src="${app:getLocalUrl() }/assets/ext/js/uploadify/add_img.png" class="imgList">
                            <input type="file" onchange="upload(0)" class="imgFile"/>
                        </div>
                        <input type="hidden" name="image" class="logo" value="" />
                    </td>
                </tr>
            </table>

            <p>
                <label>备注：</label>
                <input type="text" name="remark" value=""/>
            </p>

            <p>
                <label>内容：</label>
                <textarea class="required" cols="85" rows="6" name="content" ></textarea>
            </p>

        </div>
        <div class="formBar">
            <ul>
                <li>
                    <div class="buttonActive">
                        <div class="buttonContent" style="text-align: center;">
                            <button type="submit" onclick="return check()">保存</button>
                        </div>
                    </div>
                </li>
            </ul>
        </div>
    </form>
</div>

<script>

    // 设置图片地址
    function setImage(index,url) {
        $('.imgList').eq(index).attr('src',url);
        $('.logo').eq(index).val(url);
    }

    function upload(index) {
        uploadImage(index,$('.imgFile').eq(index).get(0).files[0]);
    }

    function check() {
        if( $(".ann-add select[name='types']").val() == ""){
            alert("请选择公告类型");
            return false;
        }
    }

</script>
